require("../css/commCss/normalize.less");
require("../css/commCss/reset.less");
require("../css/commCss/property.less");
require("../css/commCss/basic.less");
require("../fonts/iconfont.css");
require("../css/sporting.less");

//axios
const axios = require("axios");

document.addEventListener("DOMContentLoaded", function () {
    /* 获取元素 */
    const miles=document.querySelector('#miles')//公里
    const calorie=document.querySelector('#calorie')//卡路里
    const updateTime=document.querySelector('#updateTime')//时间

    //获取用户ID
    let userId=localStorage.userId;
    axios.get('http://139.9.177.51:8099/sports/exerciseData?id='+userId)
    .then(function(res){
        let data=res.data.data;
        
        /* 渲染公里 */
        miles.textContent=data.miles;

        /* 渲染卡路里 */
        calorie.textContent=data.calorie;
   
        /* 渲染时间 */
        let update=data.updateTime.substr(11,8)
        updateTime.textContent=update;
    })

})